home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Learn Microsoft Visual Basic 6.0 Now
/
Learn Microsoft Visual Basic 6.0 Now (Microsoft Press)(X03-58607)(1998).ISO
/
media
/
chap10
/
b10d015.cc2
< prev
next >
Wrap
Text File
|
1998-06-07
|
3KB
|
58 lines
0, In this demonstration I'll show you how
3, you can create a database front end with
5, the data control and several bound
8, textbox controls. The database I'll connect
11, to is biblio.mdb, a Microsoft Access
14, database that is supplied with Visual
17, Basic. Biblio includes a database
21, bibliography, including books about database
23, programming. So here the program is in the
27, Visual Basic development environment. And
29, as you can see, I'm using a data object
32, and four textbox objects. There are also
36, labels that describe what the textbox
38, objects do. The important settings for the
41, data object are name, which specifies
45, the name of the object that'll be used
48, when I create my bound textbox controls.
52, Another important property is caption,
54, which displays the name inside the data
56, control, and connect, which specifies the
60, type of database. In this case, it's
62, Access. Also the database name property is
65, important. This will bring up a listbox
68, that allows me to scroll to find my
70, database. And in this case I have selected
72, the biblio.mdb in the LVB Chapter 10
76, folder. Also, I've set the read-only
80, property to true. That means that no one can
85, modify the records in my database. And
88, I've set the record set type property to
91, table. Now record set specifies a type of
94, record set object that I want to create.
98, I've also set the record source
100, property to titles. And that specifies the
103, underlying table in the database. Okay, if
107, we look at one of our bound textbox
110, objects we can see two important properties.
114, First, the data field property specifies
117, title, which is the name of our table in
119, the database. And the data source property
123, specifies dat.biblio as our source. And
126, that's the name of the data object we
128, used above. Okay, now when I run the
130, program I can use the buttons on the data
132, object to explore the database. I can go
135, to the next record by clicking the small
138, button on the right side, and I can go to
144, the previous record by clicking the
146, small button on the left side. If I want to
150, go to the last record in the database I
152, can click the outer right button. And
156, if I want to go to the first record in
157, the database I can click the outer left
160, button. Best of all, this entire program
165, has only one line of program code. That's
168, the end statement that closes the
170, program when I click the quit button.
174, END